package com.example.dw.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.dw.entity.ActivityBigType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 活动大类Mapper接口
 * @author system
 * @since 2024-01-01
 */
@Mapper
public interface ActivityBigTypeMapper extends BaseMapper<ActivityBigType> {

    /**
     * 分页获取所有活动大类
     */
    @Select("SELECT * FROM activity_big_type ORDER BY createdAt DESC LIMIT #{offset}, #{size}")
    List<ActivityBigType> getAllBigTypeByPage(@Param("offset") Integer offset, @Param("size") Integer size);

    /**
     * 获取活动大类总数
     */
    @Select("SELECT COUNT(*) FROM activity_big_type")
    Integer getBigTypeCount();

    /**
     * 获取所有活动大类
     */
    @Select("SELECT * FROM activity_big_type ORDER BY createdAt DESC")
    List<ActivityBigType> getAllBigTypes();

    /**
     * 根据id获取活动大类
     */
    @Select("SELECT * FROM activity_big_type WHERE bigid = #{id}")
    ActivityBigType getActivityBigTypeById(Integer id);

} 